﻿using Little.Soldier.SWIFT;
using Little.Soldier.SWIFT.Definition;
using System.Collections.Generic;
using System.ComponentModel;

namespace Little.Soldier.SWIFT.Messages.Category0
{
  public class MT061 : SwiftMessage
  {
    private static SwiftMessageDefinition MessageDefinition;
    private static SwiftTagDefinition U0002;
    private static SwiftTagSubItemDefinition U0003;
    private static SwiftTagDefinition U0004;
    private static SwiftTagSubItemDefinition U0005;
    private static SwiftTagDefinition U0006;
    private static SwiftTagSubItemDefinition U0007;
    private static SwiftTagSequenceDefinition U0008;
    private static SwiftTagDefinition U000E;
    private static SwiftTagSubItemDefinition U000F;
    private static SwiftTagDefinition U0010;
    private static SwiftTagSubItemDefinition U0011;
    private static SwiftTagDefinition U0012;
    private static SwiftTagSubItemDefinition U0013;
    private static SwiftTagDefinition U0014;
    private static SwiftTagDefinition U0015;
    private static SwiftTagSubItemDefinition U0016;
    private static SwiftTagDefinition U0017;
    private static SwiftTagSubItemDefinition U0018;

    [Description("section-number")]
    public Tag202 SectionNumber_202
    {
      get
      {
        return new Tag202((SwiftElement) this, 0, (SwiftDefinitionElement) MT061.U0002);
      }
    }

    [Description("section-number")]
    public Tag202 Tag202_SectionNumber
    {
      get
      {
        return this.SectionNumber_202;
      }
    }

    [Description("total-sections")]
    public Tag203 TotalSections_203
    {
      get
      {
        return new Tag203((SwiftElement) this, 0, (SwiftDefinitionElement) MT061.U0004);
      }
    }

    [Description("total-sections")]
    public Tag203 Tag203_TotalSections
    {
      get
      {
        return this.TotalSections_203;
      }
    }

    [Description("value-date-ordering")]
    public Tag206 ValueDateOrdering_206
    {
      get
      {
        return new Tag206((SwiftElement) this, 0, (SwiftDefinitionElement) MT061.U0006);
      }
    }

    [Description("value-date-ordering")]
    public Tag206 Tag206_ValueDateOrdering
    {
      get
      {
        return this.ValueDateOrdering_206;
      }
    }

    [Description("")]
    public MT061.LTSelectStatusSequenceClass[] LTSelectStatusSequence
    {
      get
      {
        int index = -1;
        List<MT061.LTSelectStatusSequenceClass> list = new List<MT061.LTSelectStatusSequenceClass>();
        int count;
        do
        {
          ++index;
          MT061.LTSelectStatusSequenceClass statusSequenceClass = new MT061.LTSelectStatusSequenceClass((SwiftElement) this, index, false);
          count = this.ListTags((SwiftElement) statusSequenceClass).Count;
          if (count > 0)
            list.Add(statusSequenceClass);
        }
        while (count > 0);
        return list.ToArray();
      }
    }

    public MT061()
      : base(true)
    {
    }

    public MT061(SwiftMessage message)
      : base(message)
    {
    }

    public MT061.LTSelectStatusSequenceClass AddLTSelectStatusSequence()
    {
      return new MT061.LTSelectStatusSequenceClass((SwiftElement) this, this.LTSelectStatusSequence.Length, true);
    }

    public void RemoveLTSelectStatusSequence(MT061.LTSelectStatusSequenceClass sequence)
    {
      foreach (SwiftTag tag in this.ListTags((SwiftElement) sequence))
        this.RemoveTag(tag);
    }

    internal override SwiftMessageDefinition MsgDefinition()
    {
      return MT061.MessageDefinition;
    }

    protected override void InitSwiftMessageDefinition()
    {
      MT061.MessageDefinition = new SwiftMessageDefinition("MT061", "Select Status Report for FIN");
      MT061.U0002 = new SwiftTagDefinition("SectionNumber_202", "section-number");
      MT061.U0002.TagName = "{202:";
      MT061.U0003 = new SwiftTagSubItemDefinition("SectionNumber", "section-number");
      MT061.U0002.Elements.Add((SwiftDefinitionElement) MT061.U0003);
      MT061.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT061.U0002);
      MT061.U0004 = new SwiftTagDefinition("TotalSections_203", "total-sections");
      MT061.U0004.TagName = "{203:";
      MT061.U0005 = new SwiftTagSubItemDefinition("TotalSections", "total-sections");
      MT061.U0004.Elements.Add((SwiftDefinitionElement) MT061.U0005);
      MT061.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT061.U0004);
      MT061.U0006 = new SwiftTagDefinition("ValueDateOrdering_206", "value-date-ordering");
      MT061.U0006.TagName = "{206:";
      MT061.U0007 = new SwiftTagSubItemDefinition("ValueDateOrdering", "value-date-ordering");
      MT061.U0006.Elements.Add((SwiftDefinitionElement) MT061.U0007);
      MT061.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT061.U0006);
      MT061.U0008 = new SwiftTagSequenceDefinition("LTSelectStatusSequence", "");
      MT061.U0008.Multiple = true;
      MT061.U000E = new SwiftTagDefinition("LTCode_305", "lt-code");
      MT061.U000E.TagName = "{305:";
      MT061.U000F = new SwiftTagSubItemDefinition("LTCode", "lt-code");
      MT061.U000E.Elements.Add((SwiftDefinitionElement) MT061.U000F);
      MT061.U0008.Elements.Add((SwiftDefinitionElement) MT061.U000E);
      MT061.U0010 = new SwiftTagDefinition("LTSelectStatus_337", "lt-select-status");
      MT061.U0010.TagName = "{337:";
      MT061.U0011 = new SwiftTagSubItemDefinition("LTSelectStatus", "lt-select-status");
      MT061.U0010.Elements.Add((SwiftDefinitionElement) MT061.U0011);
      MT061.U0008.Elements.Add((SwiftDefinitionElement) MT061.U0010);
      MT061.U0012 = new SwiftTagDefinition("LTDirectedQueue_208", "lt-directed-queue");
      MT061.U0012.TagName = "{208:";
      MT061.U0012.Mandatory = false;
      MT061.U0013 = new SwiftTagSubItemDefinition("LTDirectedQueue", "lt-directed-queue");
      MT061.U0012.Elements.Add((SwiftDefinitionElement) MT061.U0013);
      MT061.U0008.Elements.Add((SwiftDefinitionElement) MT061.U0012);
      MT061.U0014 = new SwiftTagDefinition("DeliverySubsetList_338", "delivery-subset-list");
      MT061.U0014.TagName = "{338:";
      MT061.U0014.Mandatory = false;
      MT061.U0008.Elements.Add((SwiftDefinitionElement) MT061.U0014);
      MT061.U0015 = new SwiftTagDefinition("ValueDateToday_116", "value-date-today");
      MT061.U0015.TagName = "{116:";
      MT061.U0015.Mandatory = false;
      MT061.U0016 = new SwiftTagSubItemDefinition("ValueDateToday", "value-date-today");
      MT061.U0015.Elements.Add((SwiftDefinitionElement) MT061.U0016);
      MT061.U0008.Elements.Add((SwiftDefinitionElement) MT061.U0015);
      MT061.U0017 = new SwiftTagDefinition("LTSubsetsSharedFlag_118", "lt-subsets-sharedflag");
      MT061.U0017.TagName = "{118:";
      MT061.U0017.Mandatory = false;
      MT061.U0018 = new SwiftTagSubItemDefinition("LTSubsetsSharedFlag", "lt-subsets-sharedflag");
      MT061.U0017.Elements.Add((SwiftDefinitionElement) MT061.U0018);
      MT061.U0008.Elements.Add((SwiftDefinitionElement) MT061.U0017);
      MT061.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT061.U0008);
    }

    public class LTSelectStatusSequenceClass : SwiftTagSequence
    {
      internal override SwiftDefinitionElement Definition
      {
        get
        {
          return (SwiftDefinitionElement) MT061.U0008;
        }
      }

      [Description("lt-code")]
      public Tag305 LTCode_305
      {
        get
        {
          return new Tag305((SwiftElement) this, 0, (SwiftDefinitionElement) MT061.U000E);
        }
      }

      [Description("lt-code")]
      public Tag305 Tag305_LTCode
      {
        get
        {
          return this.LTCode_305;
        }
      }

      [Description("lt-select-status")]
      public Tag337 LTSelectStatus_337
      {
        get
        {
          return new Tag337((SwiftElement) this, 0, (SwiftDefinitionElement) MT061.U0010);
        }
      }

      [Description("lt-select-status")]
      public Tag337 Tag337_LTSelectStatus
      {
        get
        {
          return this.LTSelectStatus_337;
        }
      }

      [Description("lt-directed-queue")]
      public Tag208 LTDirectedQueue_208
      {
        get
        {
          return new Tag208((SwiftElement) this, 0, (SwiftDefinitionElement) MT061.U0012);
        }
      }

      [Description("lt-directed-queue")]
      public Tag208 Tag208_LTDirectedQueue
      {
        get
        {
          return this.LTDirectedQueue_208;
        }
      }

      [Description("delivery-subset-list")]
      public Tag338 DeliverySubsetList_338
      {
        get
        {
          return new Tag338((SwiftElement) this, 0, (SwiftDefinitionElement) MT061.U0014);
        }
      }

      [Description("delivery-subset-list")]
      public Tag338 Tag338_DeliverySubsetList
      {
        get
        {
          return this.DeliverySubsetList_338;
        }
      }

      [Description("value-date-today")]
      public Tag116 ValueDateToday_116
      {
        get
        {
          return new Tag116((SwiftElement) this, 0, (SwiftDefinitionElement) MT061.U0015);
        }
      }

      [Description("value-date-today")]
      public Tag116 Tag116_ValueDateToday
      {
        get
        {
          return this.ValueDateToday_116;
        }
      }

      [Description("lt-subsets-sharedflag")]
      public Tag118 LTSubsetsSharedFlag_118
      {
        get
        {
          return new Tag118((SwiftElement) this, 0, (SwiftDefinitionElement) MT061.U0017);
        }
      }

      [Description("lt-subsets-sharedflag")]
      public Tag118 Tag118_LTSubsetsSharedFlag
      {
        get
        {
          return this.LTSubsetsSharedFlag_118;
        }
      }

      internal LTSelectStatusSequenceClass(SwiftElement parent, int index, bool createTags)
        : base(parent, index, createTags)
      {
      }
    }
  }
}
